Optimal. Leaf size=57 \[ -i \text{PolyLog}\left (2,-i e^{i x}\right )+i \text{PolyLog}\left (2,i e^{i x}\right )+2 x \sin (x)+2 \cos (x)+2 i x \tan ^{-1}\left (e^{i x}\right ) \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.0674738, antiderivative size = 57, normalized size of antiderivative = 1., number of steps used = 12, number of rules used = 7, integrand size = 8, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.875, Rules used = {4431, 3296, 2638, 4407, 4181, 2279, 2391} \[ -i \text{PolyLog}\left (2,-i e^{i x}\right )+i \text{PolyLog}\left (2,i e^{i x}\right )+2 x \sin (x)+2 \cos (x)+2 i x \tan ^{-1}\left (e^{i x}\right ) \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 4431
Rule 3296
Rule 2638
Rule 4407
Rule 4181
Rule 2279
Rule 2391
Rubi steps
\begin{align*} \int x \cos (2 x) \sec (x) \, dx &=\int (x \cos (x)-x \sin (x) \tan (x)) \, dx\\ &=\int x \cos (x) \, dx-\int x \sin (x) \tan (x) \, dx\\ &=x \sin (x)+\int x \cos (x) \, dx-\int x \sec (x) \, dx-\int \sin (x) \, dx\\ &=2 i x \tan ^{-1}\left (e^{i x}\right )+\cos (x)+2 x \sin (x)+\int \log \left (1-i e^{i x}\right ) \, dx-\int \log \left (1+i e^{i x}\right ) \, dx-\int \sin (x) \, dx\\ &=2 i x \tan ^{-1}\left (e^{i x}\right )+2 \cos (x)+2 x \sin (x)-i \operatorname{Subst}\left (\int \frac{\log (1-i x)}{x} \, dx,x,e^{i x}\right )+i \operatorname{Subst}\left (\int \frac{\log (1+i x)}{x} \, dx,x,e^{i x}\right )\\ &=2 i x \tan ^{-1}\left (e^{i x}\right )+2 \cos (x)-i \text{Li}_2\left (-i e^{i x}\right )+i \text{Li}_2\left (i e^{i x}\right )+2 x \sin (x)\\ \end{align*}
Mathematica [A] time = 0.031047, size = 77, normalized size = 1.35 \[ -i \left (\text{PolyLog}\left (2,-i e^{i x}\right )-\text{PolyLog}\left (2,i e^{i x}\right )\right )-x \left (\log \left (1-i e^{i x}\right )-\log \left (1+i e^{i x}\right )\right )+2 x \sin (x)+2 \cos (x) \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.192, size = 81, normalized size = 1.4 \begin{align*} -i \left ( x+i \right ){{\rm e}^{ix}}+i \left ( x-i \right ){{\rm e}^{-ix}}+x\ln \left ( 1+i{{\rm e}^{ix}} \right ) -x\ln \left ( 1-i{{\rm e}^{ix}} \right ) -i{\it dilog} \left ( 1+i{{\rm e}^{ix}} \right ) +i{\it dilog} \left ( 1-i{{\rm e}^{ix}} \right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F] time = 0., size = 0, normalized size = 0. \begin{align*} 2 \, x \sin \left (x\right ) + 2 \, \cos \left (x\right ) - 2 \, \int \frac{x \cos \left (2 \, x\right ) \cos \left (x\right ) + x \sin \left (2 \, x\right ) \sin \left (x\right ) + x \cos \left (x\right )}{\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} + 2 \, \cos \left (2 \, x\right ) + 1}\,{d x} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] time = 0.529158, size = 405, normalized size = 7.11 \begin{align*} -\frac{1}{2} \, x \log \left (i \, \cos \left (x\right ) + \sin \left (x\right ) + 1\right ) + \frac{1}{2} \, x \log \left (i \, \cos \left (x\right ) - \sin \left (x\right ) + 1\right ) - \frac{1}{2} \, x \log \left (-i \, \cos \left (x\right ) + \sin \left (x\right ) + 1\right ) + \frac{1}{2} \, x \log \left (-i \, \cos \left (x\right ) - \sin \left (x\right ) + 1\right ) + 2 \, x \sin \left (x\right ) + 2 \, \cos \left (x\right ) + \frac{1}{2} i \,{\rm Li}_2\left (i \, \cos \left (x\right ) + \sin \left (x\right )\right ) + \frac{1}{2} i \,{\rm Li}_2\left (i \, \cos \left (x\right ) - \sin \left (x\right )\right ) - \frac{1}{2} i \,{\rm Li}_2\left (-i \, \cos \left (x\right ) + \sin \left (x\right )\right ) - \frac{1}{2} i \,{\rm Li}_2\left (-i \, \cos \left (x\right ) - \sin \left (x\right )\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int x \cos{\left (2 x \right )} \sec{\left (x \right )}\, dx \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int x \cos \left (2 \, x\right ) \sec \left (x\right )\,{d x} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]